home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 21
/
AMIGAplus Sonderheft 21 (1999)(ICP)(DE)[!].iso
/
PublicDomain
/
System
/
recoverdeldir
/
arexx
/
Lister
< prev
next >
Wrap
Text File
|
1999-08-23
|
5KB
|
157 lines
/* $VER: Lister 1.1 (12.5.1999) by Ralf Heinert */
/* DirOpus ARexx-Script (opens a DOpus5-lister) */
/* Created for usage in guides */
/* Structure: */
/* DH0:Directory/Docs/The.Guide */
/* DH0:Directory/Docs/Stuff/File */
/* DH0:Directory/ARexx/Lister (This Script) */
/* Usage: */
/* @{"Button" rx "/ARexx/Lister <Dir> [REQ|Files] [Opt]"} */
/* <Dir>: */
/* No argument : */
/* = PROGDIR (e.g. the location of the guide) Lister -> DH0:Directory/Docs/ */
/* If you want the lister to do something else, */
/* you have to fill <Dir> with 'PROGDIR'. */
/* PROGDIR = PROGDIR (e.g. the location of the guide) Lister PROGDIR DEST -> DH0:Directory/Docs/ */
/* Dir = Directory in PROGDIR Lister Stuff -> DH0:Directory/Docs/Stuff/ */
/* / = Directory above PROGDIR Lister / -> DH0:Directory/ */
/* // = Directory above Directory above PROGDIR Lister // -> DH0: */
/* /Dir = Directory in the directory above PROGDIR Lister /ARexx -> DH0:Directory/ARexx/ */
/* Ram:T = Absolute Path 'Ram:T' */
/* [Files]: */
/* Files (Filenames) to be selected */
/* e.g LISTER Ram: Disk.info */
/* [REQ]: */
/* If the first word after the directory is REQ */
/* the following words will be parsed as text */
/* and will be displayed in a lister-requester. */
/* e.g. Lister Ram: REQ This is a destinationlister DEST */
/* [Opt]: */
/* SOURCE -> lister set handle source */
/* SOURCELOCK -> lister set handle source lock */
/* DEST -> lister set handle dest */
/* DESTLOCK -> lister set handle dest lock */
PARSE ARG Dir Files
OPTIONS RESULTS
IF Pos("/",Dir) = 1 THEN DO
n = 1
DO WHILE Substr(Dir,2,1) = "/"
Dir = Substr(Dir,2)
n = n + 1
END
Prd = Pragma('D')
DO i = 1 TO n
IF Pos("/",Prd) = 0 THEN
Prd = Left(Prd,LastPos(":",Prd))
ELSE DO
Prd = Left(Prd,Length(Prd)-1)
IF Pos("/",Prd) = 0 THEN
Prd = Left(Prd,LastPos(":",Prd))
ELSE
Prd = Left(Prd,LastPos("/",Prd))
END
END
IF Length(Dir) > 1 THEN
Dir = Prd||SubStr(Dir,2)
ELSE Dir = Prd
END
ELSE IF Dir = '' | Upper(Dir) = 'PROGDIR' THEN
Dir = Pragma('D')
ELSE IF Pos(":",Dir) = 0 & Length(Dir) > 0 THEN DO
Prd = Pragma('D')
IF Length(Dir) > 0 THEN DO
IF Pos(":",Prd) ~= Length(Prd) THEN
Dir = Prd"/"SubStr(Dir,1)
ELSE
Dir = Prd||SubStr(Dir,1)
END
ELSE Dir = Prd
END
Dir = Strip(Dir,'B','/')
i = 0
FileList = D2C(10)
DO WHILE Files ~= ''
i = i + 1
Parse Var Files File.i Files
IF Left(File.i,4) ~= "DEST" & Left(File.i,6) ~= "SOURCE" & File.i ~= "REQ" THEN
FileList = FileList||File.i||D2C(10)
END
File.0 = i - 1
DOpusPort = "DOPUS.1"
IF Show('P',DOpusPort) THEN ADDRESS VALUE DOpusPort
ELSE DO
CALL _GetLanguage()
IF Language = "deutsch" THEN
address command 'c:RequestChoice "Fehler" "DOpus läuft nicht !*nKann keinen Lister öffnen." "OK"'
ELSE
address command 'c:RequestChoice "Error" "DOpus isn`t running !*nCannot open any Lister." "OK"'
EXIT
END
IF EXISTS(Dir) THEN DO
address value DOpusPort
lister new '-1/-1/300/250 'Dir
handle = RESULT
lister wait handle
/* deselect entries */
Lister query handle selentries stem sels
DO se = 0 TO sels.count - 1
Lister select handle sels.se 0
END
/* deactivate dest-listers */
Lister query dest stem destlister
IF Left(File.i,4) = "DEST" THEN DO
n = 0
DO WHILE Left(destlister.n,4) ~= 'DEST'
Lister set destlister.n off
n = n + 1
END
lister refresh handle
END
SELECT
WHEN File.i = "SOURCE" THEN lister set handle source
WHEN File.i = "SOURCELOCK" THEN lister set handle source lock
WHEN File.i = "DEST" THEN lister set handle dest
WHEN File.i = "DESTLOCK" THEN lister set handle dest lock
OTHERWISE DO
lister set handle off
IF i > 0 THEN
File.0 = File.0 + 1
END
END
IF File.1 = "REQ" THEN
Lister request handle Filelist
ELSE IF File.0 > 0 THEN DO s = 1 TO File.0
Lister select handle File.s 1
END
lister refresh handle
END
ELSE DO
CALL _GetLanguage()
IF Language = "deutsch" THEN
address command 'c:RequestChoice "Fehler" "Das Verzeichnis*n'Dir'*nexistiert nicht !" "OK"'
ELSE
address command 'c:RequestChoice "Error" "The directory*n'Dir'*ndoesn`t exists !" "OK"'
EXIT
END
_GetLanguage:
IF Open('lg','ENV:language','R') THEN DO
language = ReadLn('lg')
Call Close('lg')
END
ELSE Language = "english"
Return
EXIT